<template>
  <view class="order-type"></view>
</template>

<script>
export default {
  data() {
    return {
      date: "",
      lunar: false,
      range: {
        before: "",
        after: ""
      },
      customDate: false,
      startDate: "",
      endDate: ""
    };
  },
  computed: {},
  created() {
    this.init();
  },
  methods: {
    init() {
      this.range.before = this.$day()
        .subtract(6, "days")
        .format("YYYY-MM-DD");
      this.range.after = this.$day().format("YYYY-MM-DD HH:mm:ss");
      this.endDate = this.range.after;
    },
    confirm(e) {
      this.range = e.range;
      this.customDate = true;
      this.handleChange();
    },
    handleChange() {
      this.$emit("change", this.handleRange(this.range));
    },
    handleRange(range) {
      return {
        startTime: range.before,
        endTime: range.after + " 23:59:59"
      };
    },
    showCalender() {
      // this.lunar = true;
      this.$refs.calender.open();
    }
  }
};
</script>

<style scoped  lang="scss">
.order-type {
  display: flex;
  justify-content: space-between;
  // padding: 20rpx 0;
  height: 100rpx;
  line-height: 100rpx;
  font-size: $uni-font-size-lg;
  .defalut-filter {
    color: $uni-text-color-grey;
  }
  .date-filter {
    flex-grow: 1;
    color: $uni-color-primary;
    text-align: right;
  }
}
</style>
